package com.xltq.controller;

import com.xltq.entity.User;
import com.xltq.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author 王权富贵
 */
@Controller
@RequestMapping("user")
public class IUserController {
    @Autowired
    private IUserService iUserService;
    @RequestMapping("login")
    public String login(String username,String password){
        System.out.println(username+password);
        if (iUserService.aBoolean(username, password)) {
            return "/index.jsp";
        }
        return "/error.jsp";
    }
    @RequestMapping("insert")
    public String login(User user){
        System.out.println(user);
        if (iUserService.insertUser(user)==0) {
            return "/error.jsp";
        }
        return "/index.jsp";
    }
}
